layui.use(['form','jquery','table','layer'],function() {
    let form = layui.form,
        $ = layui.jquery,
        table = layui.table,
        layer = layui.layer;

$(function () {
    $.get('/system-user/search',function (data) {
        console.log(data.data);
       // var name = document.getElementById("name");name = data.data.name;
        $("#name").val(data.data.name);
        $("#logName").val(data.data.logName);
        $("#roleName").val(data.data.roleName);
        $("#code").val(data.data.code);
        $("#status").val(data.data.status);
        $("#creationTime").val(data.data.creationTime);
        $("#name").val(data.data.name);
        $("#logPwd").val(data.data.logPwd);
    })
});

$(".editPwd").click(function () {
    var data={};
    var name=document.getElementById("name");
    var logName=document.getElementById("logName");
    var logPwd=document.getElementById("logPwd");
    data[name.name]=name.value;
    data[logName.name]=logName.value;
    data[logPwd.name]=logPwd.value;
    console.log(data);
    // let user_form = layer.getChildFrame('body', index).find("#editPwd");
    // let data1 = {};
    // //把数组转为JSON
    // user_form.serializeArray().forEach(function (val) {
    //     data1[val.name] = val.value;
    // });
    $.post('/system-user/editPwd', data, function (info) {
        console.log(data);
        //layer.close(index);
        layer.msg(info.msg);

    });
});
});
